5 DIM O$(5): DIM H$(10):H$="0123456789"
75 PRINT : PRINT
80 PRINT "TRY YOUR HAND AT GOVERNING ANCIENT"
82 PRINT "SUMERIA SUCCESSFULLY FOR A 10-YEAR TERM"
85 PRINT "OF OFFICE."

95 D1=1:P1=0

100 Z=0:P=95:S=2800:H=3000:E=H-S
110 Y=3:A=H/Y:I=5:Q=1
210 D=0
215 PRINT : PRINT : PRINT "HAMURABI: I BEG TO REPORT TO YOU,"
216 Z=Z+1:PRINT "IN YEAR ";Z;", ";D;" PEOPLE STARVED,": PRINT I;" CAME TO THE CITY."      

218 P=P+I
227 IF Q>0 THEN 230
228 P=P/2
229 PRINT "A HORRIBLE PLAGUE STRUCK!!!": PRINT "--- HALF THE POPULATION DIED ---"
230 PRINT "THE POPULATION IS NOW ";P
232 PRINT "THE CITY NOW OWNS ";A;" ACRES."
233 PRINT "YOU HARVESTED ";Y;" BUSHELS PER ACRE,"
250 PRINT "RATS ATE ";E;" BUSHELS,"
252 PRINT "YOU NOW HAVE "FS;" BUSHELS IN STORE.": PRINT 
270 IF Z=11 THEN 860
310 C=RND(10)+1:Y=C+17
312 PRINT "LAND IS TRADING AT ";Y;" BUSHELS PER ACRE,"
320 PRINT "HOW MANY ACRES DO YOU WISH TO BUY";
321 GOSUB 5000:Q=O1
322 IF Y*Q<=S THEN 330
323 GOSUB 710
324 GOTO 320
330 PRINT : IF Q=0 THEN 340
331 A=A+Q:S=S-Y*Q:C=0
334 GOTO 400
340 PRINT "HOW MANY ACRES DO YOU WISH TO SELL";
341 GOSUB 5000:Q=O1
342 IF Q<A THEN 350
343 GOSUB 720
344 GOTO 340
350 A=A-Q:S=S+Y*Q:C=0
400 PRINT 
410 PRINT "HOW MANY BUSHELS DO YOU WISH TO FEED YOUR PEOPLE";
411 GOSUB 5000:Q=O1
420 IF Q<=S THEN 430
421 GOSUB 710
422 GOTO 410
430 S=S-Q:C=1: PRINT 
440 PRINT "HOW MANY ACRES DO YOU WISH TO PLANT": PRINT "WITH SEED";
441 GOSUB 5000:D=O1: IF D=0 THEN 511
445 IF D<=A THEN 450
446 GOSUB 720
447 GOTO 440
450 IF D/2<S THEN 455
452 GOSUB 710
453 GOTO 440
455 IF D<=10*P THEN 510
460 PRINT "BUT YOU HAVE ONLY ";P;" PEOPLE"
470 GOTO 440
510 S=S-D/2
511 GOSUB 800
515 Y=C:H=D*Y:E=0
521 GOSUB 800
522 C9= RND (2): IF C9#1 THEN 530
525 E=S/C
530 S=S-E+H
531 GOSUB 800
533 A9=A/100:S9=S/100:I9=C*(20*A9+S9):I=I9/P
540 C=Q/20
542 Q= RND (20)-3
550 IF P<C THEN 210
552 D=P-C: IF 10*D>4*P THEN 560
553 P1=((Z-1)*P1+D*100/P)/Z
555 P=C:D1=D1+D: GOTO 215
560 PRINT : PRINT "YOU STARVED ";D;" PEOPLE IN ONE YEAR!!!"
565 PRINT "DUE TO THIS EXTREME MISMANAGEMENT YOU": PRINT "HAVE NOT ONLY BEEN IMPEACHED AND THROWN"
566 PRINT "OUT OF OFFICE BUT YOU HAVE ALSO BEEN"
567 PRINT "DECLARED 'NATIONAL FINK'!!!": GOTO 990
710 PRINT : PRINT "HAMURABI: THINK AGAIN, YOU HAVE ONLY"
711 PRINT S;" BUSHELS OF GRAIN. NOW THEN"
712 RETURN 
720 PRINT : PRINT "HAMURABI: THINK AGAIN,"
721 PRINT "YOU OWN ONLY ";A;" ACRES. NOW THEN"
730 RETURN 
800 C= RND (5)+1
801 RETURN 
860 PRINT "IN YOUR 10 YEAR TERM OF OFFICE ";P1: PRINT "PERCENT OF THE POPULATION STARVED ON THE"      
862 PRINT "AVERAGE, I.E., A TOTAL OF ";D1;" PEOPLE"
865 PRINT "DIED!!!":L=A/P
870 PRINT "YOU STARTED WITH 10 ACRES PER PERSON ": PRINT "AND ENDED WITH ";L;" ACRES"
875 PRINT "PER PERSON.": PRINT      
880 IF P1>33 THEN 565
885 IF L<7 THEN 565
890 IF P1>10 THEN 940
892 IF L<9 THEN 940
895 IF P1>3 THEN 960
896 IF L<10 THEN 960
900 PRINT "A FANTASTIC PERFORMANCE!!!": PRINT "CHARLEMANGE,DISRAELI, AND JEFFERSON"
905 PRINT "COMBINED COULD NOT HAVE DONE BETTER!": GOTO 990
940 PRINT "A LOUSY PERFORMANCE!!!"
945 PRINT "THE PEOPLE (REMAINING) FIND YOU AN": PRINT "UNPLEASANT RULER, AND FRANKLY "
950 PRINT "HATE YOUR GUTS!!!": GOTO 990
960 PRINT "YOUR PERFORMANCE COULD HAVE BEEN BETTER"
965 PRINT "BUT WASN'T TOO BAD, "; RND (P/2);" PEOPLE WOULD "      
970 PRINT "LOVE TO SEE YOU ASSASSINATED."
990 PRINT "SO LONG FOR NOW"
999 END 
5000 INPUT O$
5010 O1=0:O2=1
5020 FOR O3= LEN(O$) TO 1 STEP -1: FOR O4=1 TO 10
5030 IF O$(O3,O3)=H$(O4,O4) THEN O1=O1+O2*(O4-1)
5040 NEXT O4: IF O3#1 THEN O2=O2*10: NEXT O3
5050 RETURN 

